﻿using System;
using System.Web.Mvc;
using System.Web.Routing;

namespace easyccms.WebUI.Infrastructure
{
  public class DiControllerFactory : IControllerFactory
  {
    public IController CreateController(RequestContext context, Type controllerType)
    {

      return (IController)DependencyInjector.Resolve(controllerType);
    }

    public IController CreateController(RequestContext requestContext, string controllerName)
    {
      return (IController)DependencyInjector.Resolve<IController>(controllerName);
    }

    public void ReleaseController(IController controller)
    {
      DependencyInjector.Release(controller);
    }
  }
}